from django.urls import path,re_path

from admin import views

app_name = "admin"

urlpatterns = [
    path('', views.IndexView.as_view(), name='index'),
    path('index_fn', views.index_fn, name='index_fn'),
    path('tags/', views.TagManageView.as_view(), name='tags_manage'),
    path('tags/<int:tag_id>/', views.TagManageView.as_view(), name='tags_manage'),
    # path('tags/<int:tag_id>/',views.TagManageView.as_view(),name='tags_put'),#url重复可省略
    path('news/', views.NewsManageView.as_view(), name='news_manage'),
    path('news/<int:news_id>/', views.NewsManageView.as_view(), name='news_manage'),
    path('news/pub/', views.NewsPubView.as_view(), name='news_pub'),

    path('news/images/', views.NewsUploadImage.as_view(), name='upload_image'),
    path('token/', views.UploadToken.as_view(), name='upload_token'),  # 七牛云上传图片需要调用token

    path('hotnews/', views.HotNewsManageView.as_view(), name='hotnews_manage'),
    path('hotnews/<int:hotnews_id>/', views.HotNewsEditView.as_view(), name='hotnews_edit'),
    path('hotnews/add/', views.HotNewsAddView.as_view(), name='hotnews_add'),
    path('tags/<int:tag_id>/news/', views.NewsByTagIdView.as_view(), name='news_by_tagid'),

    path('banners/', views.BannerManageView.as_view(), name='banners_manage'),
    path('banners/<int:banner_id>/', views.BannerManageView.as_view(), name='banners_manage'),

    path('docs/', views.DocsManageView.as_view(), name='docs_manage'),
    path('docs/<int:doc_id>/', views.DocsManageView.as_view(), name='docs_manage'),
    path('docs/pub/', views.DocsPubView.as_view(), name='docs_pub'),
    path('docs/files/', views.DocsUploadFile.as_view(), name='upload_text'),

    path('courses/', views.CoursesManageView.as_view(), name='courses_manage'),
    path('courses/<int:course_id>/', views.CoursesEditView.as_view(), name='courses_edit'),
    path('courses/pub/', views.CoursesPubView.as_view(), name='courses_pub'),

    path('groups/', views.GroupsManageView.as_view(), name='groups_manage'),
    path('groups/<int:group_id>/', views.GroupsEditView.as_view(), name='groups_edit'),
    path('groups/add/', views.GroupsAddView.as_view(), name='groups_add'),


    path('users/', views.UsersManageView.as_view(), name='users_manage'),
    path('users/<int:user_id>/', views.UsersEditView.as_view(), name='users_edit'),

    path('email/',views.RepasswordView.as_view(),name='re_password'),
    re_path(r'email/(?P<sms_text>\w*)/(?P<sms_num>\w*)/',views.RepasswordView.as_view(),name='re_password'),
]

